.PHONY: all clean clean_obj

TARGET_CC := ${TC_PREFIX}gcc

CCFLAGS		:= -gstabs -I../inc/ -nostdlib -nostdinc -fno-builtin

LIBGCC		:= $(shell ${TARGET_CC} -print-libgcc-file-name)

FIND ?= /usr/bin/find
LN ?= ln
ECHO ?= echo

SRCFILES:= $(shell ${FIND} . -iname "*.c" -or -iname "*.S" | sed -e 's!\./!!g')
HEADERS := $(shell ${FIND} . -iname "*.h" | sed -e 's!\./!!g')

OBJFILES:= $(addprefix ../target/lib_,$(addsuffix .o,${SRCFILES}))

all: ${OBJFILES}

../target/lib_%.o: %
	@${ECHO} CC $<
	${V}${TARGET_CC} ${CCFLAGS} $< -c -o$@
